import type { SelectMixedOption } from 'naive-ui/es/select/src/interface';

export function enumToOption(enumType: any, filter?: boolean): SelectMixedOption[] {
  const option: SelectMixedOption[] = [];
  let index = -1;
  const keys = Object.keys(enumType) as Array<string>;
  keys.forEach(key => {
    index += 1;
    if (filter && index < keys.length / 2) {
      return;
    }
    if (filter) {
      option.push({ label: key, value: enumType[key] });
    } else {
      option.push({ label: enumType[key], value: key });
    }
  });
  return option;
}
